import request from "@/utils/request";
export function pageList(params, pageNum = 1, pageSize = 5) {
    const major = params.major;  // 从params中获取专业名称
    if (major) {
        params.major = major;  // 确保专业名称存在于params对象中，可根据实际后端要求调整具体赋值逻辑
    }
    return request.post(`/system/student/list?pageNum=${pageNum}&pageSize=${pageSize}`, params);
}

export function insertStudent(student) {
    return request.post("/system/student", student);
}

export function getStudent() {
    return request.get("/system/student");
}


export function deleteStudent(id) {
    console.log(id);

    return request.delete(`/system/student?id=${id}`);
}


export function updateStudent(student) {
    return request.put(`/system/student`, student);
}

// 登录功能函数
export function login(username, password) {
    return request.get(`/system/userlogin?username=${username}&password=${password}`);
}

// 注册功能函数
export function register(userInfo) {
    return request.post("/system/register", userInfo);
}